home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 July
/
EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso
/
lightwave
/
arexx_macros
/
lwscenemacros
/
lwobj.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-09-05
|
3KB
|
100 lines
/*
LWObj.rexx
Copyright (C) 1994 Earl C. Terwilliger
Phone (606)-723-5718
Internet: AISTERWI@ACS.EKU.EDU
Conmpuserve: 70575,1330
Non-Commercial USE granted to ALL !!!
LWObj.rexx is a sample Arexx script to read
a LightWave 3D Object file. It does run OK
as it is and tells a few things about the
contents of of the Object file.
It can be further used as a starting point
('skeleton') for further enhancement.
*/
/* TRACE(RESULTS) */
OPTIONS RESULTS
parse arg file
if arg() = 0 then call syntax()
if ~exists(file) then call syntax()
if ~show('L',"rexxsupport.library") then do
if addlib('rexxsupport.library',0,-30,0) then
say "Added rexxsupport.library."
else do
say "Error: addlib() of rexxsupport.library failed."
exit 10
end
end
open('infile',file,'R')
instring = readch('infile',12)
if (substr(instring,9,4) ~= "LWOB") then do
close('infile')
say file' is not a LW Object file!'
exit(10)
end
form = substr(instring,1,4)
length = c2d(substr(instring,5,4),4)
hex = c2x(substr(instring,5,4))
type = substr(instring,9,4)
say file' file 'form' is 'type
length = length + 8
say file 'file size is' length 'bytes' "'"hex"'"'X'
do while eof('infile')=0
instring=readch('infile',8)
if (eof('infile') = 1) then break
chunk = substr(instring,1,4)
length = c2d(substr(instring,5,4),4)
hex = c2x(substr(instring,5,4))
say 'Chunk Type is' chunk 'with a length of' length 'bytes' "'"hex"'"'X'
if (chunk = "PNTS") then do
points = length / 12
say "Number of points = " points
end
if (chunk = "SURF") then do
instring = readch('infile',length)
surfacepos = pos('00'x,instring,1)
surface = substr(instring,1,(surfacepos-1))
surfacepos = surfacepos + (surfacepos // 2) + 1
say 'Surface Name:' surface
do while (surfacepos < length)
subchunk = substr(instring,surfacepos,4)
say 'Subchunk of ' subchunk
surfacepos = surfacepos + 4
len = c2d(substr(instring,surfacepos,2),4)
surfacepos = surfacepos + 2
if (subchunk = "TIMG") then do
timage = strip(substr(instring,surfacepos,len),'T','00'x)
say 'Texture Image ->' timage
end
if (subchunk = 'RIMG') then do
rimage = strip(substr(instring,surfacepos,len),'T','00'x)
say 'Reflection Image ->' rimage
end
surfacepos = surfacepos + len
end
end
else seek('infile',length,'C')
end
close('infile')
exit 0
syntax:
say
say 'Syntax: rx LWOB [drive:directory/]LW-Object-File'
say
exit 10